<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ include file="taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <t:header title="Edit Auction"/>
    </head>
    <body>
        <div id="header">
            <div id="titleSection">
                <t:pageheader title="Edit User"/>
            </div>
        </div>
        <div id="contentPanel">
            <div id="pageContent">
                <div class="sectionTitle">Edit Auction</div>
                <s:errors/>
                <s:form action="/Auction.action">

                    <table class="leftRightForm">
                        <tr>
                            <th><s:label name="auction.id">Auction Id:</s:label></th>
                            <td>
                                ${actionBean.auction.id}<s:hidden name="auction.id"/>
                                <s:hidden name="page"/>
                                <s:hidden name="mode"/>
                            </td>
                            <td><s:errors field="auction.id"/></td>
                        </tr>
                        <tr>
                            <th><s:label name="auction.teacherId">Teacher:</s:label></th>
                            <td>
                                <s:select name="auction.teacherId">
                                    <s:options-collection collection="${actionBean.teachers}" value="id" label="fullName"/>
                                </s:select>
                            </td>
                            <td><s:errors field="auction.teacherId"/></td>
                        </tr>
                        <tr>
                            <th><s:label name="auction.title">Title:</s:label></th><td><s:text name="auction.title"/></td><td><s:errors field="auction.title"/></td>
                        </tr>
                        <tr>
                            <th><s:label name="auction.startAmount">Starting Amount:</s:label></th><td><s:text name="auction.startAmount" formatPattern="decimal"/></td><td><s:errors field="auction.startAmount"/></td>
                        </tr>
                        <tr>
                            <th><s:label name="auction.increment">Bid Increment:</s:label></th><td><s:text name="auction.increment" formatPattern="decimal" /></td><td><s:errors field="auction.increment"/></td>
                        </tr>
                        <tr>
                            <th><s:label name="auction.amauctionount">Current Amount:</s:label></th><td><s:text name="auction.amount" formatPattern="decimal"/></td><td><s:errors field="auction.amount"/></td>
                        </tr>
                        <tr>
                            <th><s:label name="auction.startDate">Start Date:</s:label></th><td><s:text name="auction.startDate" formatType="datetime"/></td><td><s:errors field="auction.startDate"/></td>
                        </tr>
                        <tr>
                            <th><s:label name="auction.endDate">End Date:</s:label></th><td><s:text name="auction.endDate" formatType="datetime"/></td><td><s:errors field="auction.endDate"/></td>
                        </tr>
                        <c:if test="${!empty actionBean.auction.picBlob}">
                            <s:url var="url" beanclass="pkg.action.ImageActionBean">
                                <s:param name="auction.id" value="${actionBean.auction.id}"/>
                                <s:param name="image"/>
                            </s:url>
                            <tr>
                                <th>Current Picture:</th><td><img src="${url}" /> </td><td></td>
                            </tr>
                        </c:if>
                        <tr>
                            <th><s:label name="picture">New Picture:</s:label></th><td><s:file name="picture" /></td><td><s:errors field="picture"/></td>
                        </tr>
                        <tr>
                            <th><s:label name="auction.active">Is Active:</s:label></th><td><s:checkbox name="auction.active" /></td><td><s:errors field="auction.active"/></td>
                        </tr>
                        <tr>
                            <th><s:label name="auction.description">Description:</s:label></th><td><s:textarea name="auction.description" /></td><td><s:errors field="auction.description"/></td>
                        </tr>
                    </table>
                    <div class="buttons">
                        <s:submit value="Save" name="save"/>
                        <t:buttonLink value="Cancel" beanclass="pkg.action.AuctionActionBean">
                            <t:param name="page" value="${actionBean.page}"/>
                        </t:buttonLink>
                    </div>
                </s:form>
            </div>
        </div>
    </body>
</html>
